import java.io.*;
import java.net.*;


public class HttpHeaderClient {
	
    public static void main(String[] args) throws IOException {
        System.out.println("This is HTTP Header Client Initializing...");
        System.out.println("Contacting server ...");
        System.out.println(args[0]);
        
        Socket mysocket = null;
        PrintWriter out = null;
        BufferedReader in = null;
        String message = "GET / HTTP/1.1\r\n\r\n";  
        String host = args[0];
        int port = 80;
        try {
        	mysocket = new Socket();
        	mysocket.connect(new InetSocketAddress(host , port));
        	System.out.println("Connected");
            //PrintWriter myout = new PrintWriter(mysocket.getOutputStream(), true);
            //BufferedReader myin = new BufferedReader(new InputStreamReader(mysocket.getInputStream()));
        } catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			System.out.println("Socket error");}
        try {
        	out = new PrintWriter(mysocket.getOutputStream(), true);
        	in = new BufferedReader(new InputStreamReader(mysocket.getInputStream())); }
        catch(IOException e){System.out.println("IO error"); }
        
        out.println(message);
        //int i=0;
        //String response;
        while (in.readLine()!=null)
            {
        			try {
						System.out.println( in.readLine() );
					} catch (IOException e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
					}
        			//i++;
        	    }
      
    }
}
